package org.xlx.xlx_oa.meet.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xlx.xlx_oa.common.ResponseBean;
import org.xlx.xlx_oa.meet.domain.dto.MeetRoomDto;
import org.xlx.xlx_oa.meet.domain.vo.MeetRoomVo;
import org.xlx.xlx_oa.meet.service.MeetRoomService;

import java.util.List;

@RestController
@RequestMapping("/v1/meet-room")
public class MeetRoomController implements org.xlx.xlx_oa.meet.api.MeetRoomApi {
    @Autowired
    private MeetRoomService meetRoomService;

    @PostMapping("/save")
    @Override
    public ResponseBean<Boolean> saveMeetRoom(@RequestBody MeetRoomVo roomVo) {
        return ResponseBean.successFactory(meetRoomService.saveMeetRoom(roomVo));
    }

    @GetMapping("/remove/{id}")
    @Override
    public ResponseBean<Boolean> removeMeetRoom(@PathVariable(value = "id") Long id) {
        return ResponseBean.successFactory(meetRoomService.removeMeetRoom(id));
    }

    @GetMapping("/list")
    @Override
    public ResponseBean<List<MeetRoomDto>> getListRooms(@RequestBody MeetRoomVo roomVo) {
        return ResponseBean.successFactory(meetRoomService.getMeetRoomList(roomVo));
    }

    @GetMapping("/detail/{id}")
    @Override
    public ResponseBean<MeetRoomDto> getRoom(@PathVariable(value = "id") Long id) {
        return ResponseBean.successFactory(meetRoomService.getMeetRoom(id));
    }
}

